import shutil
from datetime import datetime

currentDateAndTime = str(datetime.now())

print(currentDateAndTime.split('.')[0].replace(' ', '_').replace(':', '-'))
FileName = currentDateAndTime.split('.')[0].replace(' ', '_').replace(':', '-') + '.h264'

# 打开目标文件
with open(FileName, 'wb') as target_file:
    index = 0

    while True:
        path = 'C://Users//22076//Desktop//7.5 机场测试数据//MCmanager_7_2//mcm//captureVideo//file_' + str(
            index) + '.h264'

        # path = ''

        with open(path, 'rb') as source_file:
            # 将源文件的内容复制到目标文件
            shutil.copyfileobj(source_file, target_file)

        print(index)
        index = index + 1
